home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Information / WebSites / Wirenet / files / Dashboard2.lha / Dashboard2 / AmiTCP / bin / Fetch < prev    next >
Text File  |  1998-03-27  |  3KB  |  86 lines

  1. /*
  2. $VER: Fetch 2.0 (26.3.98)
  3. (c) Neil Bothwick
  4.  
  5. Gets mail and/or news, retrying until a connection
  6. is made or a maximum number of retries is reached
  7. */
  8.  
  9. /* ;;;Change these to suit your setup */
  10. SystemName = 'Wirenet'                          /* The name of your Internet system in Thor */
  11. Logging    = 1                                  /* Set to 1 to enable logging, 0 to disable it */
  12. LogFile    = 'UUSpool:Info.log'                 /* DO NOT use logging unless you have at least Thor 2.3 */
  13. ;;;
  14. /* ;;;Don't change anything below here */
  15. arg option
  16. options results
  17. address command
  18. options failat 21
  19. ;;;
  20. /* ;;;Check to see if fetch is already running */
  21. 'checkcmd >NIL: GetTCP'
  22. if RC = 0 then call ExitMsg('You are already collecting mail or news')
  23. ;;;
  24. /* ;;;Execute PreFetch script */
  25. if exists('Wirenet:UserScripts/PreFetch') then address command 'Wirenet:UserScripts/PreFetch'
  26. ;;;
  27. /* ;;;Build command string */
  28. NumSockets = getclip('NewsSockets')
  29. MaxTries = getclip('MaxTries')
  30. CmdStr = GetVar('Thor/ThorPath')'bin/GetTCP' SystemName 'PUBSCREEN "" GETONLY'
  31. MailStr = 'DELETE PASSWORD' getclip('Password') 'MAILSERVER' getclip('MailServer') 'USERNAME' getclip('MailBox')
  32. NewsStr = 'NEWSSERVER' getclip('NewsServer') 'SOCKETS' NumSockets
  33.  
  34. if option = '' then do
  35.     choice = rtezrequest('Fetch Mail, News or All?','_All|_Mail|_News|_Cancel','Fetch','rt_reqpos = reqpos_centerscr')
  36.     select
  37.         when choice = 1 then option = 'ALL'
  38.         when choice = 2 then option = 'MAIL'
  39.         when choice = 3 then option = 'NEWS'
  40.         otherwise exit
  41.         end
  42.     end
  43.  
  44. select
  45.     when option = 'MAIL' then do
  46.         CmdStr = CmdStr 'NONEWS' MailStr
  47.         end
  48.     when option = 'NEWS' then do
  49.         CmdStr = CmdStr 'NOMAIL' NewsStr
  50.         end
  51.     when option = 'ALL' then do
  52.         CmdStr = CmdStr MailStr NewsStr
  53.         end
  54.     otherwise ExitMsg('Usage: Fetch Mail|News|All')
  55.     end
  56. ;;;
  57. /* ;;;Call ParseThor to remove any batched mail or news in tcp_tmp */
  58. 'Wirenet:bin/ParseThor'
  59. ;;;
  60. /* ;;;Call GetTCP until successful or max retries reached */
  61. do try = 1 to MaxTries
  62.     if Logging = 1 then do
  63.         TempLog = 'T:Fetch.'||time(s)
  64.         CmdStr = CmdStr 'LOGFILE' TempLog
  65.         end
  66.     CmdStr
  67.     if Logging = 1 then 'run >NIL: ShowLog' TempLog req log info
  68.     if RC=0 then do
  69.         leave try
  70.         end
  71.     end
  72.  
  73. if try > MaxTries then ExitMsg('Failed to get mail after' MaxTries 'attempts')
  74. ;;;
  75. /* ;;;Execute PostFetch script */
  76. if exists('Wirenet:UserScripts/PostFetch') then address command 'Wirenet:UserScripts/PostFetch'
  77. exit
  78. ;;;
  79. /* ;;;Exit with a message */
  80. ExitMsg: Procedure
  81.     parse arg Msg
  82.     call rtezrequest(Msg,' OK ','Fetch error','rt_reqpos = reqpos_centerscr')
  83.     exit
  84.     return
  85. ;;;
  86.